<!--
 * @Author: TaoLer <alipay_tao@qq.com>
 * @Date: 2021-12-06 16:04:51
 * @LastEditTime: 2022-07-26 13:11:56
 * @LastEditors: TaoLer
 * @Description: 搜索引擎SEO优化设置
 * @FilePath: \github\TaoLer\view\taoler\index\login\login.html
 * Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
-->
{extend name="public/base" /}

{block name="title"}用户登录{/block}
{block name="column"}{/block}
{block name="content"}
<div class="layui-container fly-marginTop">
  <div class="fly-panel fly-panel-user" pad20>
    <div class="layui-tab layui-tab-brief" lay-filter="user">
      <ul class="layui-tab-title">
        <li class="layui-this">{:lang('login')}</li>
        <li><a href="{:url('user_reg')}">{:lang('sign up')}</a></li>
      </ul>
      <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
        {if config('taoler.config.is_login') == 1}
        <div class="layui-tab-item layui-show">
          <div class="layui-form layui-form-pane">
            <form method="post" >
              <div class="layui-form-item">
                <label  class="layui-form-label">{:lang('username')}</label>
                <div class="layui-input-inline">
                  <input type="text" id="L_name" name="name" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="{:lang('mail/username/mobile')}">
                </div>
              </div>
              <div class="layui-form-item">
                <label for="L_pass" class="layui-form-label">{:lang('password')}</label>
                <div class="layui-input-inline">
                  <input type="password" id="L_pass" name="password" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="{:lang('please input the password')}">
                </div>
              </div>
			      {if config('taoler.config.login_captcha') == 1}
              <div class="layui-form-item">
                <label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
                <div class="layui-input-inline">
                  <input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux" style="padding-top: 0px !important;">                 
					        <img src="{:captcha_src()}" style="float:left; cursor:pointer;" id="captcha" alt="captcha"  />
                </div>
              </div>
			      {/if}
			        <div class="layui-form-item">
                <input type="checkbox" name="remember" title="{:lang('remember password')}" lay-skin="primary"  lay-filter="remember" value="1">
              </div>
              <div class="layui-form-item">
                <button type="submit" name="submit" class="layui-btn" lay-filter="user" lay-submit id="login">{:lang('login now')}</button>
                <span style="padding-left:20px;">
                  <a href="{$Request.domain}{:url('user_forget')}">{:lang('forget password')}？</a>
                </span>
              </div>
              {:hook('socialhook')}
            </form>
          </div>
        </div>
        {else /}
        <div class="layui-form-item">抱歉，网站维护中，暂时不能登录，耐心等待一下哦！</div>
        {/if}
      </div>
    </div>
  </div>
</div>
{include file="public/menu" /}
{/block}

{block name="script"}
<script>
  $(function() {
    $('#login').click(function() {
      var loadIndex = layer.load(2);
      $.ajax({
        type:"post",
        url:"{:url('login/index')}",
        data:$('form').serialize(),
        daType:"json",
        success:function (res){
          layer.close(loadIndex);
          if (res.code === 0) {
            toast.success({title:"成功消息",message: res.msg});
            location.href = res.url;
          } else {
            toast.error({title:"失败消息",message:res.msg});
            layui.jquery('#captcha').attr('src', '{:captcha_src()}?'+Math.random());
          }
        }
      });
    return false;
    });
  });
// 更新验证码
  layui.jquery('#captcha').on('click',function(){
    layui.jquery('#captcha').attr('src', '{:captcha_src()}?'+Math.random());
  })
</script>
{/block}